package com.prs.crm.service.cdxh.impl;

import java.util.List;

import com.prs.crm.dao.cdxh.EarningSalDao;
import com.prs.crm.domain.cdxh.EarningSal;
import com.prs.crm.service.cdxh.EarningSalService;
import com.prs.crm.service.impl.BaseServiceImpl;

/**
 * @author LanXiaoGang
 * @E-mail:lan9liang@163.com
 * @qq:7857553326
 * @version 创建时间：2010-12-16 下午01:11:27 简单说明
 */

public class EarningSalServiceImpl extends
		BaseServiceImpl<EarningSal, EarningSalDao> implements EarningSalService {
	private EarningSalService earningSalService;

	@Override
	public String getSal(String hrName, String data) {
//		System.out.println("进入");
		List<EarningSal> eglist = this.getEarningSalService().getEarningSal(
				hrName, data);
		double addNums = 0.0;
		double delNums = 0.0;
		if(eglist.size()==0){
			
		}else{
		for (EarningSal es : eglist) {
			delNums = delNums + es.getPoundNum();
			addNums = addNums + es.getRewardNum();
		}
		}
		String overs = "0.0";
		if (addNums < delNums) {
			overs = "-" + (delNums - addNums);
		} else {
			overs = (addNums - delNums) + "";
		}

		return overs;
	}

	@Override
	public List<EarningSal> getEarningSal(String hrname, String date) {

		return this.getDao().getEarningSal(hrname, date);
	}

	public EarningSalService getEarningSalService() {
		return earningSalService;
	}

	public void setEarningSalService(EarningSalService earningSalService) {
		this.earningSalService = earningSalService;
	}

}
